﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using RBS.Common;
using RBS.Core.DAL;
namespace RBS.Core.BLL
{
    public partial class Siteconfig
    {
        private readonly DAL.Siteconfig _dal = new DAL.Siteconfig();

        /// <summary>
        ///  读取配置文件
        /// </summary>
        public RBS.Core.Model.Siteconfig loadConfig()
        {
            var model = CacheHelper.Get<RBS.Core.Model.Siteconfig>(RBSKeys.CACHE_SITE_CONFIG);
            if (model == null)
            {
                CacheHelper.Insert(RBSKeys.CACHE_SITE_CONFIG, _dal.LoadConfig(Utils.GetXmlMapPath(RBSKeys.FILE_SITE_XML_CONFING)),
                    Utils.GetXmlMapPath(RBSKeys.FILE_SITE_XML_CONFING));
                model = CacheHelper.Get<RBS.Core.Model.Siteconfig>(RBSKeys.CACHE_SITE_CONFIG);
            }
            return model;
        }

        /// <summary>
        ///  保存配置文件
        /// </summary>
        public RBS.Core.Model.Siteconfig saveConifg(RBS.Core.Model.Siteconfig model)
        {
            return _dal.saveConifg(model, Utils.GetXmlMapPath(RBSKeys.FILE_SITE_XML_CONFING));
        }

    }
}
